<?php
namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class GoodnumberController extends Controller{
    public function number_index(){
    	$info=DB::table("goodnumber")->get();
        return view("Number/index",['info'=>$info]);
    }
    public function number_add(Request $r){
    	$data=$r->except('_token');
    	$data['good_status']='1';
    	$data['good_addtime']=date("Y-m-d H:i:s");
    	$data['good_user']='0';
    	$data['good_userid']='0';
    	$data['good_needtime']='1';
    	$data['good_count']=strlen($data['good_number']);
    	$info=DB::table("goodnumber")->insert($data);
    	if($info){
    		return redirect("number_index");
    	}else{
    		echo "添加失败";
    	}
    }
    public function number_delte($id){
    	$info=DB::table("goodnumber")->where("id",$id)->delete();
    	if($info){
    		return redirect("number_index");
    	}else{
    		echo "删除失败";
    	}
    }
    public function number_edit($id){
    	$info=DB::table("goodnumber")->where("id",$id)->first();
    	return view("Number/edit",["info"=>$info]);
    }
}